﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfoExpress.HIV.WinApp.Business;
using InfoExpress.HIV.Services;

namespace InfoExpress.HIV.WinApp.Utils
{
  public static class GlobalCache
  {
    /// <summary>
    /// Set valid permission in Login form. 
    /// Remove permission in Logout of Main form.
    /// </summary>
    public static Permission Permission;

    #region BenhNhanDangKyService

    private static BenhNhanDangKyService _benhNhanDangKyService;
    public static BenhNhanDangKyService BenhNhanDangKyService
    {
      get
      {
        if (_benhNhanDangKyService == null)
          _benhNhanDangKyService = new BenhNhanDangKyService();

        return _benhNhanDangKyService;
      }
    }

    #endregion

    #region DieuTriService

    private static DieuTriService _dieuTriService;
    public static DieuTriService DieuTriService
    {
      get
      {
        if (_dieuTriService == null)
          _dieuTriService = new DieuTriService();

        return _dieuTriService;
      }
    }

    #endregion

    #region ThayDoiDieuTriService

    private static ThayDoiDieuTriService _thayDoiDieuTriService;
    public static ThayDoiDieuTriService ThayDoiDieuTriService
    {
      get
      {
        if (_thayDoiDieuTriService == null)
          _thayDoiDieuTriService = new ThayDoiDieuTriService();

        return _thayDoiDieuTriService;
      }
    }

    #endregion

    #region LichSuDieuTriService

    private static LichSuDieuTriService _lichSuDieuTriService;
    public static LichSuDieuTriService LichSuDieuTriService
    {
      get
      {
        if (_lichSuDieuTriService == null)
          _lichSuDieuTriService = new LichSuDieuTriService();

        return _lichSuDieuTriService;
      }
    }

    #endregion

    #region ChuyenOpcBufferService

    private static ChuyenOpcBufferService _chuyenOpcBufferService;
    public static ChuyenOpcBufferService ChuyenOpcBufferService
    {
      get
      {
        if (_chuyenOpcBufferService == null)
          _chuyenOpcBufferService = new ChuyenOpcBufferService();

        return _chuyenOpcBufferService;
      }
    }

    #endregion

    #region PhanLoaiBenhNhanService

    private static PhanLoaiBenhNhanService _phanLoaiBenhNhanService;
    public static PhanLoaiBenhNhanService PhanLoaiBenhNhanService
    {
      get
      {
        if (_phanLoaiBenhNhanService == null)
          _phanLoaiBenhNhanService = new PhanLoaiBenhNhanService();

        return _phanLoaiBenhNhanService;
      }
    }

    #endregion

    #region ThayDoiPhacDoService

    private static ThayDoiPhacDoService _thayDoiPhacDoService;
    public static ThayDoiPhacDoService ThayDoiPhacDoService
    {
      get
      {
        if (_thayDoiPhacDoService == null)
          _thayDoiPhacDoService = new ThayDoiPhacDoService();

        return _thayDoiPhacDoService;
      }
    }

    #endregion

    #region Legacy Services

    #region DoiTuongService

    private static PdmdtService _pdmdtService;
    public static PdmdtService DoiTuongService
    {
      get
      {
        if (_pdmdtService == null)
          _pdmdtService = new PdmdtService();

        return _pdmdtService;
      }
    }

    #endregion

    #region NguyCoLayNhiemService

    private static PdmnclnService _pdmnclnService;
    public static PdmnclnService NguyCoLayNhiemService
    {
      get
      {
        if (_pdmnclnService == null)
          _pdmnclnService = new PdmnclnService();

        return _pdmnclnService;
      }
    }

    #endregion

    #region NgheNghiepService

    private static PdmnnService _pdmnnService;
    public static PdmnnService NgheNghiepService
    {
      get
      {
        if (_pdmnnService == null)
          _pdmnnService = new PdmnnService();

        return _pdmnnService;
      }
    }

    #endregion

    #region PhuongXaService

    private static PdmphxaService _pdmphxaService;
    public static PdmphxaService PhuongXaService
    {
      get
      {
        if (_pdmphxaService == null)
          _pdmphxaService = new PdmphxaService();

        return _pdmphxaService;
      }
    }

    #endregion

    #region QuanHuyenService

    private static PdmqhService _pdmqhService;
    public static PdmqhService QuanHuyenService
    {
      get
      {
        if (_pdmqhService == null)
          _pdmqhService = new PdmqhService();

        return _pdmqhService;
      }
    }

    #endregion

    #region TinhTpService

    private static UtTinhService _utTinhService;
    public static UtTinhService TinhTpService
    {
      get
      {
        if (_utTinhService == null)
          _utTinhService = new UtTinhService();

        return _utTinhService;
      }
    }

    #endregion

    #region UsersService

    private static SUsersService _sUsersService;
    public static SUsersService UsersService
    {
      get
      {
        if (_sUsersService == null)
          _sUsersService = new SUsersService();

        return _sUsersService;
      }
    }

    #endregion

    #region DonViService

    private static UtDmdvService _utDmdvService;
    public static UtDmdvService DonViService
    {
      get
      {
        if (_utDmdvService == null)
          _utDmdvService = new UtDmdvService();

        return _utDmdvService;
      }
    }

    #endregion

    #region PhacDoService

    private static UtPhacdoService _utPhacdoService;
    public static UtPhacdoService PhacDoService
    {
      get
      {
        if (_utPhacdoService == null)
          _utPhacdoService = new UtPhacdoService();

        return _utPhacdoService;
      }
    }

    #endregion

    #region XetNghiemService

    private static UtDmxnService _utDmxnService;
    public static UtDmxnService XetNghiemService
    {
      get
      {
        if (_utDmxnService == null)
          _utDmxnService = new UtDmxnService();

        return _utDmxnService;
      }
    }

    #endregion

    #endregion
  }
}
